

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
		<g:javascript library="prototype" />
		<resource:dateChooser/>
        <title>Create Parameter</title>         
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLinkTo(dir:'')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list">Parameter List</g:link></span>
        </div>
        <div class="body">
            <h1>Create Parameter</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${reportParameter}">
            <div class="errors">
                <g:renderErrors bean="${reportParameter}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" method="post" >
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="report">Report:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'report','errors')}">
                                    <g:select id="report" optionKey="id" from="${Report.list()}" name="report.id" value="${reportParameter?.report?.id}" ></g:select>
                                </td>
                            </tr>                           
							
							<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="dataTypeList">Data Type:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'dataType','errors')}">
								    <g:select name="dataTypeList.id" from="${dataTypeList}" value="${reportParameter?.dataType.encodeAsHTML()}"
									          id="dataTypeList" optionKey="id" optionValue="codeDesc"
											  onchange="${remoteFunction(action:'refreshOperatorList',update:'opSelectList',params:'\'dataTypeId=\' +this.value')}"
											  />
								</td>
                            </tr>      

							<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="defaultOperator">Default Operator:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'defaultOperator','errors')}" id="opSelectList">
                                    <g:select  name="operatorList.id" from="${operatorList}" value="${reportParameter?.defaultOperator.encodeAsHTML()}"
											  id="defaultOperator" optionKey="id" optionValue="codeDesc"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="parameterDisplayName">Parameter Display Name:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'parameterDisplayName','errors')}">
                                    <input type="text" maxlength="45" id="parameterDisplayName" name="parameterDisplayName" value="${fieldValue(bean:reportParameter,field:'parameterDisplayName')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="parameterName">Parameter Name:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'parameterName','errors')}">
                                    <input type="text" id="parameterName" name="parameterName" value="${fieldValue(bean:reportParameter,field:'parameterName')}"/>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="parameterValue">Parameter Value:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'parameterValue','errors')}">
                                    <input type="text" class="orderByText" id="parameterValue" name="parameterValue" value="${fieldValue(bean:reportParameter,field:'parameterValue')}"/>
                                </td>
                            </tr>

							<tr class="prop">
                                <td valign="top" class="name">
                                    <label for="parameterValue2">Parameter Value2:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'parameterValue2','errors')}">
                                    <input type="text" class="orderByText" id="parameterValue2" name="parameterValue2" value="${fieldValue(bean:reportParameter,field:'parameterValue2')}"/>
                                </td>
                            </tr>
                                                
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="comments">Comments:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'comments','errors')}">
                                    <textarea rows="5" cols="40" name="comments">${reportParameter?.comments?.encodeAsHTML()}</textarea>
                                </td>
                            </tr> 
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="parameterEnded">Parameter Ended:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:reportParameter,field:'parameterEnded','errors')}">
                                    <g:select id="parameterEnded" name="parameterEnded" from="${reportParameter.constraints.parameterEnded.inList.collect{it.encodeAsHTML()}}" value="${fieldValue(bean:reportParameter,field:'parameterEnded')}" ></g:select>
                                </td>
                            </tr>                    
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><input class="save" type="submit" value="Create" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
